Skip to content

Upgrade to upstream WebKit f59345e04a8d - #889

Merged
dylan-conway merged 195 commits into
mainfrom
bun/upgrade-to-f59345e04a8d
Oct 23, 2026
Merged

dylan-conway merged 195 commits into
mainfrom
bun/upgrade-to-f59345e04a8d

Conversation

@dylan-conway

Copy link
Copy Markdown
Member

Merges upstream WebKit f59345e04a8d (2026-10-22, 324510@main): 193 commits since 33ce3bf11a71 (#860), 37 of them in
Source/JavaScriptCore, Source/WTF or Source/bmalloc.

Please land this as a merge commit, not a squash. The merge records upstream/main as a parent, which is how the next
upgrade finds its base. This time git found the base (33ce3bf11a71) by itself.

JSType.h, .github/, the Dockerfiles and the WebCore bindings scripts are untouched by the merge. BytecodeList.rb
loses op_is_big_int, so every opcode after it is renumbered and the serialized bytecode changes. OptionsList.h gains
initialHeapVersion (tests only) and allowSharedArrayBuffer (default true, no effect while useSharedArrayBuffer is
on, which Bun sets).

It supersedes #882, which cherry-picks eaf0efa57b26.

The commits:

  1. e026fb71, the merge. What was done about the conflicts, and about the places that merged cleanly but no longer fit, is
    below and in its message.
  2. 4a6dc55b, a merge of main at e450c494 ([JSC] The control flow profiler counts the parts of a loop header #880, the control flow profiler counts the parts of a loop header), which
    landed after the branch was cut. No conflicts. Three of its files are ones upstream changed in this range
    (BytecodeList.rb, BytecodeGenerator.{h,cpp}); see "How it was verified".

What it fixes

Nine of the 26 tests upstream added or changed in this range fail on main today and pass here:

upstream what was wrong on main
1af9d482aa array[name](v) that exits on "concat" and is then called with "push" or "unshift" crashes. Plain JS, default options; it segfaults the released Bun 1.4.3.
7912651c51 this[await key] = v in an async arrow function of a derived constructor throws.
b45f2446d8 A promise resolved with itself is fulfilled, not rejected, once the code is in the DFG.
7b1cfc54c8 An overwritten arguments.length (say -1) is not converted with ToLength.
926bafc4e2 for (let; ; ), for (let in {}), for await (async of …), and a destructuring declaration without an initializer in a for head are parsed wrongly (three tests).
dd24421c84 #x in obj is compiled as InById by the DFG when access inlining is off.
cf08eff753 New $.agent limit for the fuzzer (shell only).

Also in the range: the collector's threads stop when their heap shuts down (eaf0efa57b), leftover marks after the
marking version wraps (e1a28d3cf4, d2a655b196), the reland of the DFG's truncated multiply (935eb898b4; its revert
was inside #860, so main has neither), zmij formats numbers the ECMAScript way itself (6663a9ebb8), branchless LEB
decoding for wasm (efcd462e77), and BigInt32 is removed (f59345e04a).

What needs a careful look

  • ArrayMode::refine(), DFGArrayMode.cpp (1af9d482aa). Upstream no longer falls back to Array::Generic on an
    ExoticObjectMode exit site when the mode is a JSArray, because ArrayPush and ArrayUnshift cannot be Generic. The
    fork had added a second reason to the same if, SparseIndex (76c588a). The two are now separate:

    if ((!isJSArray() && graph.hasExitSite(node->origin.semantic, ExoticObjectMode)) || graph.hasExitSite(node->origin.semantic, SparseIndex))
    • SparseIndex must not go behind !isJSArray(): it exists for JSArrays. Built that way,
      stress/arrayify-should-not-keep-exiting-for-sparse-index.js fails with "putAfterOptimized was compiled 10 times".
      With the line above it passes.
    • Can SparseIndex reach ArrayPush and bring the crash back? Not that I can find. Only Arrayify with an index child
      raises it, ArrayPush/ArrayUnshift pass no index, and no call intrinsic emits a node that does (GetByVal,
      PutByVal, HasIndexedProperty), so no such exit can share a call's origin. This is from reading the code; there is
      no test that proves the absence.
  • BigInt32 is gone (f59345e04a). It was never enabled, so nothing changes at run time, but the fork's own code used
    its names in six files that merged without a conflict. See the next section.

  • MarkedSpace::initialVersion is 1, was 2 (e1a28d3cf4), so a block at nullVersion now is one version behind a
    heap at initialVersion; upstream's old comment promised that could not happen. Every line of the fork in heap/ that
    reads a version was checked:

    • MarkedBlock::Handle::decommitUnusedPages() asks staleMarksStillRecordSurvivors(), the function whose meaning
      changed. It calls upstream's predicate rather than repeating it, so it follows isLive() as before.
    • m_lastAuxiliaryEvacuationVersion { 0 } and m_markingVersionAtLastSweep are only compared for equality with the
      heap's version, which still never is 0.
    • run-jsc-stress-tests now starts the collect-continuously modes within 32 collections of the wrap, and wraps on the
      second collection in no-cjit-validate-phases. The fork's evacuation and decommit code had never been run across a wrap.
  • ~Collector release-asserts that shutDown() ran (eaf0efa57b). Heap::shutDown() calls it and VM::~VM is the
    only caller of that, in the fork too.

Merged cleanly, but no longer fit

All of it is in the merge commit.

  • makeHeapBigIntOrBigInt32() → createFrom(), which is all it did with BigInt32 off: ffi/FFIConversions.cpp (2),
    ffi/tests/testFFI.cpp (1), tools/JSDollarVM.cpp (2).
  • bytecode/BytecodeOptimizer.cpp: case op_is_big_int: removed.
  • runtime/JSBigInt.cpp, the fork's linear-time parseInt: lengthLimitForBigInt32 → lengthLimitForInt32. A rename:
    upstream kept the values of the #else arm (30, 10, 9, 7, 1), which are the ones the fork always had.
  • dfg/DFGSpeculativeJIT64.cpp, BufferReadInt: the #if USE(BIGINT32) arm removed. It compiled (the macro is
    undefined now), but it was dead.
  • LayoutTests/js/let-syntax-expected.txt: two lines upstream added say Can't find variable: let / arr. The fork
    prints let is not defined (A1 in JSTests/BUN-TEST-DIFFERENCES.md, where let-syntax already is listed).

Two #if USE(BIGINT32) blocks are left in JSBigInt.cpp (tryToBigUInt64, tryToBigInt64). They are upstream's own
leftovers and are kept as upstream has them.

The other conflicts

5 files conflicted, one hunk each.

  • bytecompiler/BytecodeGenerator.cpp: the fork's replaceLastInstruction<OpIsCellWithType>(dst, op.m_value, HeapBigIntType),
    without the USE(BIGINT32) arm.
  • jsc.cpp: both. The fork's functionDollarIsRemoteFunction (ShadowRealm stays), then upstream's
    maxLiveAgentsInFuzzerMode.
  • runtime/JSBoundFunction.h (e50f0255bc): the fork's quoted includes, plus "SourceTaintedness.h".
  • CMakeLists.txt: both headers, HasOwnPropertyCacheInlines.h and the fork's HashMapHelper.h.
  • dfg/DFGArrayMode.cpp: above.

Checked and needing nothing

  • 91fb668ec1 (HasOwnPropertyCache caches the absence of an index key): only for FinalObjectType without indexed
    storage, so never for a class with its own getOwnPropertySlotByIndex. No code of the fork reads the cache.
  • 5596b3e3b5 (the debugger swaps a NativeExecutable's whole JITCode): it rebuilds the JITCode by type. The fork has the
    same five JITCode classes as upstream.
  • a300b87770 (forEachOwnIndexedProperty reads the butterfly): reloads butterfly() on every iteration. No caller in
    the fork's own code or in Bun.
  • 9960cb034c (immutableButterflyToStringCache moves to VM): the five mentions agree.
  • 202ef7bf88 (SharedArrayBuffer): additive in JSC. Bun sets useSharedArrayBuffer and has its own serializer.
  • 935eb898b4 (the reland): its range analysis lists node types; the fork's nodes are not among them and get the
    conservative answer.

Pull requests this touches

How it was verified

Built on macOS arm64, Release with assertions (-DENABLE_ASSERTS=ON), which no tested CI lane has. Unless it says
otherwise, what follows was run at e026fb71.

  • Every file the fork had not changed is identical to upstream's. Every file upstream had not changed is identical to
    main's, except the four listed above that were changed on purpose.

  • Of the 186 identifiers upstream dropped from JavaScriptCore, WTF and bmalloc in this range, none is used any more, in
    any file and under any #if. (This is what found testFFI.cpp, which the first build did not compile.)

  • The 26 tests upstream added or changed: 26 pass here, 17 on main.

  • The five tests of the fork's SparseIndex commit pass.

  • testb3, testair, testmasm (468), testdfg, testFFI (1,509,848 checks) and testRegExp (698) pass. CI runs only
    testFFI of these.

  • testapi stops at its first threaded test with ASSERTION FAILED: vm().currentThreadIsHoldingAPILock() in
    Heap::unprotect, from JSGlobalContextRelease. main does exactly the same, so it says nothing about the merge.

  • run-javascriptcore-tests, with CI's arguments: 124,961 runs, 54 failures in six files, none of them from the merge.
    Each failing script was run again, in its own mode, with a jsc built from main (same flags), after checking the
    method on tests known to pass and to fail there.

    test runs on main
    js/let-syntax 7 The two lines above. The suite had copied the tests before they were fixed; with the fix the output is identical to the expected file.
    stress/temporal-zoned-datetime-timezone-identifier.js 17 Same error (supportedValuesOf("timeZone") should include "Asia/Kolkata"). The time zone data of the machine it ran on.
    stress/intl-canonical-iana-time-zone.js 17 Same error.
    complex/intl-default-timezone-backward-link.js 1 Fails too.
    js/stack-trace 7 Output byte-identical to main's; both differ from the expected file in the same 16 lines (map at [native code]).
    js/JSON-parse-reviver 5 An assertion that main fails as well. See "Found on the way".
  • Driven by hand on the final binary: the >>> by 32 miscompile gives 2147483648; push after concat gives 200000 where
    main asserts in compileArrayPush; arguments.length = -1, for (let in {}) and a self-resolved promise behave, where
    main does not finish the script in 60 s; BigInt arithmetic, parsing, typed arrays and number formatting are unchanged.

  • stress/many-agents-teardown.js with its own options, repeated (the race eaf0efa57b fixes): 0 failures in 500 runs
    here, 12 in 500 on main. All 12 are the same crash, JSRunLoopTimer::Manager::scheduleTimer ←
    Heap::stopTheMutator ← Collector::CollectorThread::work, on a VM that is being destroyed. An earlier batch of 60 here
    had one non-zero exit whose output was not kept, while the whole suite was running beside it; 150 more runs and the 500
    above did not repeat it, so what it was is not known.

At 4a6dc55b, rebuilt:

Not verified:

  • Any platform but macOS arm64. In particular x86_64 (the LEB decoder has new IPInt assembly), Windows (zmij's
    _MSC_VER path) and the Android NDK's libc++, which is what Atomics.h needed a fallback for in Upgrade to upstream WebKit 33ce3bf11a71 #860.
  • Bun has not been built against it.

Found on the way, not part of this

  • ASSERTION FAILED: executable, getMayBeDyingNativeExecutable(), jit/JITThunks.cpp:104. The two cases at the
    end of LayoutTests/js/script-tests/JSON-parse-reviver.js on their own (a JSON.parse reviver that makes a cycle and
    overflows the stack, then anything that creates a native function) fail 36 of 36 times here and 34 of 36 on main (the
    other two were killed), with default options. JITThunks::hostFunctionStub() finds an entry in its weak set whose cell is already null.
    In the full test the same thing also shows up as a hang, a segfault or an assertion somewhere unrelated, on both builds.
    Bun 1.4.3 (release) prints the right answer 36 of 36 times. Not investigated further. No tested CI lane has assertions,
    which is why nobody has seen it.
  • testapi cannot get past its first threaded test on a build with assertions (above).

Bun's side

Unlike #860, Bun uses what upstream removed, so the version bump alone will not compile:

  • makeHeapBigIntOrBigInt32 → createFrom: JSBuffer.cpp:3081, JSCTestingHelpers.cpp:68,80,
    sqlite/NodeSqlite.cpp:326,377,2373,2375.
  • isBigInt32(): src/codegen/bindgen-emit.ts:159 (it is in generated code), bindings.cpp:4171
    (JSC__JSValue__isBigInt32, with headers.h:214 and JSValue.rs:304), bindings.cpp:4346 (an ASSERT).
  • Dead #if USE(BIGINT32) blocks to delete: bindings.cpp, napi.cpp:2905, webcore/SerializedScriptValue.cpp.
  • test/bundler/bundler_bytecode_portable.test.ts: the snapshot, and its header comment, which counts 194 opcodes and
    names op_is_big_int among the 24 that cannot be reached.
  • test/js/bun/jsc/webkit-upgrade-f59345e04a.test.ts (new): the rows of "What it fixes" are the cases.
  • Upgrade WebKit to 33ce3bf11a71 bun#46279 should land first; both change the pin and the snapshot.

jelee53 and others added 30 commits October 20, 2026 20:08
…nd AccessibilityRenderObject

https://bugs.webkit.org/show_bug.cgi?id=328287
rdar://190580677

Reviewed by Wenson Hsieh.

We can deduce OptionSet template argument for hit test types due to CTAD - omit the template type.

No new tests needed.

* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::press):
(WebCore::AccessibilityObject::visiblePositionForPoint const):
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityHitTest const):

Canonical link: https://commits.webkit.org/324318@main
…eads

https://bugs.webkit.org/show_bug.cgi?id=327243

Reviewed by Yusuke Suzuki.

This patch fixes three bugs in parseForStatement().

1. In sloppy mode, `let` is an identifier unless it starts a declaration,
   so `for (let in obj)`, `for (let; ;)` and `for (let = 3; ;)` are valid.
   We consume `let` and look at the next token, and go back only when
   `let` turns out to be an identifier, so a declaration is not lexed twice.
   `for (let.x of [])` stays a SyntaxError.

2. `for await (async of [])` is valid: only for-of has the
   [lookahead ≠ async of] restriction. We also apply that restriction to
   `for (async\nof [])`, which was accepted.

3. A destructuring declaration needs an initializer unless it is the
   binding of for-in or for-of, so `for (let [a]; ;)` is a SyntaxError.

Tests: JSTests/stress/for-await-of-head-async-identifier.js
       JSTests/stress/for-statement-head-destructuring-declaration-requires-initializer.js
       JSTests/stress/for-statement-head-let-identifier-sloppy.js

* JSTests/stress/for-statement-head-let-identifier-sloppy.js: Added.
(shouldBe):
(shouldBeSyntaxError):
(let):
(inFunction):
(inGenerator):
(async 9):
(let.async of):
(shouldBeSyntaxError.async f):
* JSTests/test262/expectations-linux.yaml:
* JSTests/test262/expectations.yaml:
* LayoutTests/js/let-syntax-expected.txt:
* LayoutTests/js/script-tests/let-syntax.js:
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseForStatement):
(JSC::Parser<LexerType>::parseVariableDeclarationList):
(JSC::Parser<LexerType>::parseVariableDeclaration):
* JSTests/stress/for-await-of-head-async-identifier.js: Added.
(shouldBe):
(shouldBeSyntaxError):
(async test.async shouldBe):
(async var):
(async catch):
(async shouldBeSyntaxError):
* JSTests/stress/for-let-comma.js:
(foo):
* JSTests/stress/for-statement-head-destructuring-declaration-requires-initializer.js: Added.
(shouldBe):
(shouldBeSyntaxError):
(shouldBeSyntaxError.async f):
* Source/JavaScriptCore/parser/Parser.h:

Canonical link: https://commits.webkit.org/324319@main
https://bugs.webkit.org/show_bug.cgi?id=327974

Reviewed by Yusuke Suzuki.

Adding a broad Symbolic Breakpoint can crash when swapping a `JITCode` shared by multiple `NativeExecutable`.

Create and replace the entire `JITCode` instead of just the internal `CodePtr` (and `ExecutableMemoryHandle`).

* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::ReplacedNativeExecutable::~ReplacedNativeExecutable): Renamed from `ReplacedThunk`.
(Inspector::ReplacedNativeExecutable::operator==): Renamed from `ReplacedThunk`.
(Inspector::replacedNativeExecutables): Renamed from `replacedThunks`.
(Inspector::InspectorDebuggerAgent::addSymbolicBreakpoint):
(Inspector::InspectorDebuggerAgent::removeSymbolicBreakpoint):
(Inspector::InspectorDebuggerAgent::didCreateNativeExecutable):
(Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState):
Drive-by: Rename `ReplacedThunk` to `ReplacedNativeExecutable` to better match the naming of `ReplacedInternalFunction`.

* Source/JavaScriptCore/runtime/NativeExecutable.h:
* Source/JavaScriptCore/runtime/NativeExecutable.cpp:
(JSC::NativeExecutable::swapGeneratedJITCodeForDebugger): Added.
(JSC::NativeExecutable::swapGeneratedJITCodeForCallForDebugger): Added.
(JSC::NativeExecutable::swapGeneratedJITCodeForConstructForDebugger): Added.
* Source/JavaScriptCore/jit/JITCode.h:
(JSC::JITCode::canSwapCodePtrWithArityCheckForDebugger const): Deleted.
(JSC::DirectJITCode::canSwapCodePtrWithArityCheckForDebugger const): Deleted.
* Source/JavaScriptCore/jit/JITCode.cpp:
(JSC::JITCode::swapCodeRefForDebugger): Deleted.
(JSC::JITCode::swapCodePtrWithArityCheckForDebugger): Deleted.
(JSC::JITCodeWithCodeRef::swapCodeRefForDebugger): Deleted.
(JSC::DirectJITCode::swapCodePtrWithArityCheckForDebugger): Deleted.
Move swapping logic from `JITCode` to `NativeExecutable`.

* LayoutTests/inspector/debugger/symbolic-breakpoint-shared-native-code.html: Added.
* LayoutTests/inspector/debugger/symbolic-breakpoint-shared-native-code-expected.txt: Added.

Canonical link: https://commits.webkit.org/324320@main
…-stop.html

https://bugs.webkit.org/show_bug.cgi?id=328270

Unreviewed test gardening.

Since 324296@main skipped transaction-abort-pending-requests-stop.html on
Win-Tests-EWS, its sibling fails the same way in every run: one
IDBTransaction stays alive after GC.

* LayoutTests/platform/win/TestExpectations:

Canonical link: https://commits.webkit.org/324321@main
…ts in GridTrackSizingAlgorithm::baselineOffsetForGridItem

https://bugs.webkit.org/show_bug.cgi?id=279411

Reviewed by Matt Woodrow.

A subgrid copies the tracks of a subgridded axis from its parent instead of
sizing them, and GridTrackSizingAlgorithm::baselineOffsetForGridItem() asserted
that a row subgrid is therefore never asked for a row baseline shim. That does
not hold while the outer grid computes its intrinsic widths: it runs a
temporary track sizing algorithm, so a subgrid laid out at that point finds no
parent tracks to copy and sizes the subgridded axis itself. Grid-lanes
containers hit this on every layout of a row subgrid with baseline-aligned
items; plain grids hit it from performPreLayoutForGridItems().

Return no shim for a subgridded axis. Its baseline alignment context belongs to
the outer grid, as RenderGrid::columnAxisBaselineOffsetForGridItem() already
assumes.

Ungardens subgrid-baseline-012.html and alignment-in-subgridded-axes-002.html,
which now pass. The seven grid-lanes tests no longer crash and fail as image
mismatches, which is how the generic expectations already garden grid-lanes
baseline alignment, so their port-specific Crash lines go too (bugs 322624,
322847 and 323004 are duplicates of this one).

* LayoutTests/TestExpectations:
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac-wk2/TestExpectations:
* LayoutTests/platform/wpe/TestExpectations:
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::baselineOffsetForGridItem const):

Canonical link: https://commits.webkit.org/324322@main
https://bugs.webkit.org/show_bug.cgi?id=328292

Unreviewed build fix.

Clang 19 and older cannot read, in a constant expression, a static
constexpr array of unknown bound declared in a class template, unless
something else forced its instantiation first. Give pow10_data::fixups
an explicit bound.

* Source/WTF/wtf/zmij/zmij.h:

Canonical link: https://commits.webkit.org/324323@main
…slow in Debug

Unreviewed test gardening.

The test computes the accessible name of a 500-level nested button,
which takes about 57 seconds in a GTK Debug build, close to the 60
second Debug timeout, and it now times out on the GTK and WPE Debug
bots.

* LayoutTests/platform/glib/TestExpectations:

Canonical link: https://commits.webkit.org/324324@main
https://bugs.webkit.org/show_bug.cgi?id=328085

Reviewed by Philippe Normand and Xabier Rodriguez-Calvar.

When a SourceBuffer is removed from its MediaSource, clearTrackBuffers()
empties the track buffers but returns before computeEvictionData(), so the
cached content size keeps the old value. A remove() still queued on the
operation chain then runs against the empty buffers and hits the
contentSize() == totalTrackBufferSizeInBytes() assertion in
removeCodedFramesInternal(). The stale value has no other observable effect,
so the crash is only visible with assertions enabled.

Recompute the eviction data whether or not the client is notified; no client
acts on the eviction data notification.

media-source-seek-past-end.html hits this on the GTK and WPE bots when the
playback pipeline error detaches the MediaSource while its audio remove() is
pending. The text failure from that error remains.

* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::clearTrackBuffers):

Canonical link: https://commits.webkit.org/324325@main
…geFileWrapperForPastedImage

https://bugs.webkit.org/show_bug.cgi?id=326127

Unreviewed test gardening.

324016@main marked this test as Skip on iOS without noticing an existing
Pass Timeout line for the same bug, so every style check warns about a
duplicate expectation. Remove the older line, keeping the Skip.

* TestExpectations/apitests:

Canonical link: https://commits.webkit.org/324326@main
rdar://137012134
https://bugs.webkit.org/show_bug.cgi?id=328120

Reviewed by Eric Carlson.

IMDB.com tries to change font size through a CSS declaration that targets
`.jw-video::-webkit-media-text-track-display`. However, `::-webkit-media-text-track-display` was
removed in favor of `::cue` in 282320@main. Opt IMDB.com into an existing quirk that maps CSS
decelarations targetting that removed pseudo element onto the right node.

* Source/WebCore/page/QuirkTable.json:
* LayoutTests/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/glib/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/ios/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/ipad/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/mac-sequoia/fast/quirks/active-quirks-by-domain-expected.txt:
* LayoutTests/platform/mac-tahoe/fast/quirks/active-quirks-by-domain-expected.txt:

Canonical link: https://commits.webkit.org/324327@main
…indows of other test processes

https://bugs.webkit.org/show_bug.cgi?id=328223
rdar://190531593

Reviewed by Alexey Proskuryakov.

Every TestWKWebView on macOS is placed in a borderless window at the same screen origin. When several TestWebKitAPI
processes run at once, those windows cover each other, the window loses NSWindowOcclusionStateVisible, and the page
is reported as hidden. Tests that need a visible page (autoplay of audible media, screen wake lock, getUserMedia,
Now Playing) then time out or fail only when run in parallel.

Disable window occlusion detection for the host window, and remove the per-test calls that did the same for a
TestWKWebView.

With occlusion detection off, a new page is visible from the start on macOS, as on iOS, so SiteIsolation.Events now
sees pagereveal on macOS too.

* Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.mm:
(-[TestWKWebView _setUpTestWindow:]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/DataDetection.mm:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/NowPlayingSession.mm:
(createWebViewInItsOwnWebContentProcess):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/RequiresUserActionForPlayback.mm:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::TEST(SiteIsolation, AutoplayPolicyInRemoteFrameFollowsMainFrame)):
(TestWebKitAPI::TEST(SiteIsolation, RemoteFrameMediaInheritsUserGestureFromMainFrame)):
(TestWebKitAPI::TEST(SiteIsolation, Events)): Expect pagereveal on all platforms.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolationSessionStateTests.swift:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SnapshotStore.mm:
(-[SnapshotTestWKWebView init]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UIDelegate.mm:
(TEST(WebKit, SaveDataToFile)):
(runOpenPDFWithPreviewTraversalTest):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UnifiedPDFTests.mm:

Canonical link: https://commits.webkit.org/324328@main
…shadow root

https://bugs.webkit.org/show_bug.cgi?id=328210
rdar://190528878

Reviewed by Ryosuke Niwa.

For a click on the shape drawn by a use element, composedPath() in a
listener on the use returns the use shadow root, and lists the use
twice:

    use > ShadowRoot > use > svg > body > html > document > window

Firefox and Chrome return:

    use > svg > body > html > document > window

SVG 2 says the use shadow tree is closed:

    The shadow tree is closed (not inspectable by script): its shadow
    root's mode is "closed".

https://w3c.github.io/svgwg/svg2-draft/struct.html#UseShadowTree

For a closed tree, composedPath() leaves its nodes out when the listener
is outside it. The DOM steps also look for the current target starting
from the end of the event path:

https://dom.spec.whatwg.org/#dom-event-composedpath

The nodes of the use shadow tree report the use as their current target,
so the event path has several entries for it. WebKit used the first
one, the copy inside the shadow tree, and filtered the path from there.
Use the last one, the use itself.

The listener still runs once per click. Only the path was wrong.

Tests: imported/w3c/web-platform-tests/svg/struct/scripted/use-composedpath-closed-shadow-tree.html

* LayoutTests/imported/w3c/web-platform-tests/svg/struct/scripted/use-composedpath-closed-shadow-tree-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/svg/struct/scripted/use-composedpath-closed-shadow-tree.html: Added.
* Source/WebCore/dom/EventPath.cpp:
(WebCore::EventPath::computePathUnclosedToTarget const):

Canonical link: https://commits.webkit.org/324329@main
…ocess stream

https://bugs.webkit.org/show_bug.cgi?id=328273
rdar://190563151

Reviewed by Kimmo Kinnunen.

Mark the remaining unbatched RemoteGraphicsContext draw messages (FillPath, FillCachedPath,
FillEllipse, StrokeRect and ClipCachedPath).

In tracing the iOS power benchmark, we see some third-party ad canvases that do dozens of FillPath
operations per frame, so coalescing these messages helps reduce the number of GPUProcess wakeups.

* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.messages.in:

Canonical link: https://commits.webkit.org/324330@main
https://bugs.webkit.org/show_bug.cgi?id=328233
rdar://190538227

Reviewed by Zak Ridouh and Tim Nguyen.

The PlayStation build compiles away RELEASE_LOG_ERROR on release builds.
324177@main logged out a variable with RELEASE_LOG_ERROR, but when that
line is compiled away the variable remains unused. This patch fixes the
build by adding an UNUSED_VARIABLE line unconditionally, which accounts
for the cases where RELEASE_LOG_ERROR is compiled away and removes the
error.

* Source/WebCore/page/RuntimeQuirkTable.cpp:
(WebCore::loadQuirkTable):

Canonical link: https://commits.webkit.org/324331@main
https://bugs.webkit.org/show_bug.cgi?id=328293

Unreviewed build fix.

Clang 19 and older ignore the requires clause of a non-template
constructor in the implicit deduction guide built from it, so
`WeakPtr weak = pointer;` deduces WeakPtr<T*> from WeakPtr(const T&).
Make that constructor a template again, as before 324303@main, taking
a non-deduced std::type_identity_t<U>, so the implicit guide built
from it can never deduce T. The explicit deduction guide still covers
references.

* Source/WTF/wtf/WeakPtr.h:
(WTF::WeakPtr::WeakPtr):

Canonical link: https://commits.webkit.org/324332@main
https://bugs.webkit.org/show_bug.cgi?id=328232
<rdar://189837669>

Reviewed by Mike Wyrzykowski.

The `IOSurfaceRef` type definition actually comes from the
`WebKit_Internal` import. And on public SDKs it was only a forward
declaration.

Remove the unused IOSurface module import and make sure public visionOS
SDKs get the real header.

* Source/WTF/wtf/spi/cocoa/IOSurfaceSPI.h:
On visionOS public SDKs, include `IOSurfaceRef.h`.
* Source/WebKit/UIProcess/Cocoa/Separated/WKSeparatedImageView+Surface.swift:
* Source/WebKit/UIProcess/Cocoa/Separated/WKSeparatedImageView.swift:
Remove the unused import.

Canonical link: https://commits.webkit.org/324333@main
…:getOrCreateTab(NSObject<WKWebExtensionTab>*) const.

https://bugs.webkit.org/show_bug.cgi?id=NEED_BUG
rdar://189810004

Reviewed by Timothy Hatcher and Brian Weinstein.

Almost all of the hangs share this trace:
tabsQuery → matches → isActive → activeTab() → tabs(SkipValidation::Yes) → getOrCreateTab

WebExtensionWindow::activeTab() validated its result by building the window's full tab list
and checking that it contained the active tab. Since WebExtensionTab::isActive() calls activeTab(),
any method that checks each tab in a window, like tabs.query(), was O(n²) since it iterated through
every tab, and did a validation check for each tab, which in itself did a lookup of all the tabs.

The validation added in e1a3439 only logs and returns nil/empty in release builds. Given its
performance impact, it's not worth keeping. Part of this validation was already removed for a similar
reason in 279929@main (rdar://129456659).

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionWindowCocoa.mm:
(WebKit::WebExtensionWindow::tabs const):
(WebKit::WebExtensionWindow::activeTab const):
* Source/WebKit/UIProcess/Extensions/WebExtensionWindow.h:

Canonical link: https://commits.webkit.org/324334@main
https://bugs.webkit.org/show_bug.cgi?id=328188
rdar://190511604

Reviewed by Dan Glastonbury.

generateShareableShaders made the translator emit the same MSL on every device,
so that metallibs compiled offline could be shared through Chrome's blob cache,
keyed by the MSL source. Upstream ANGLE removed the offline compiler paths in
869dde7224 ("Remove code paths for invoking the offline Metal compiler"), but
the feature stayed behind and was always on.

Because of it, every fragment shader contained the alpha-to-coverage emulation,
guarded by the ANGLEEmulateAlphaToCoverage function constant, and a
gl_FragCoord [[position]] input, even on GPUs that do not emulate
alpha-to-coverage. These are now emitted only when emulateAlphaToCoverage is
enabled. That is the case on non-Apple GPUs and the simulator, where the
generated shaders do not change. On Apple GPUs, the removed code was dead after
specialization.

The feature list was regenerated with include/platform/gen_features.py.

* Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h:
* Source/ThirdParty/ANGLE/include/platform/autogen/FeaturesMtl_autogen.h:
* Source/ThirdParty/ANGLE/include/platform/mtl_features.json:
* Source/ThirdParty/ANGLE/src/compiler/translator/msl/TranslatorMSL.cpp:
(sh::TranslatorMSL::translateImpl):
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/DisplayMtl.mm:
(rx::DisplayMtl::initializeFeatures):
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ShaderMtl.mm:
(rx::ShaderMtl::compile):
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/mtl_msl_utils.mm:
(rx::mtl::MTLGetMSL):
* Source/ThirdParty/ANGLE/util/autogen/angle_features_autogen.cpp:
* Source/ThirdParty/ANGLE/util/autogen/angle_features_autogen.h:

Canonical link: https://commits.webkit.org/324335@main
https://bugs.webkit.org/show_bug.cgi?id=328292

Unreviewed build fix.

324323@main gave pow10_data::fixups an explicit bound, but compute_pow10()
reads pow10_data::major first, and that array of unknown bound still
fails to be read in a constant expression with clang 19 and older. Give
it an explicit bound too. pow10_data::minor needs none, as the sizeof
in compute_pow10() already completes its type.

* Source/WTF/wtf/zmij/zmij.h:

Canonical link: https://commits.webkit.org/324336@main
https://bugs.webkit.org/show_bug.cgi?id=328309

Reviewed by Alejandro G. Castro.

We are calling SkImage::peekPixels inside an ASSERT which is a noop with
asserts disabled, so the GBytes we pass to
wpe_view_set_cursor_from_bytes() is always empty.

* Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp:
(WKWPE::ViewPlatform::setCursor):

Canonical link: https://commits.webkit.org/324337@main
https://bugs.webkit.org/show_bug.cgi?id=328229
rdar://190535359

Reviewed by Brent Fulgham and Zak Ridouh.

shippedQuirkTableJSON is not compiled into the PlayStation platform, which has caused
linkage errors. This patch adds a stub for that returns an
empty string, and skips the tests for PlayStation.

* Tools/TestWebKitAPI/Tests/WebCore/Quirks.cpp:
(TestWebKitAPI::shippedQuirkTableJSON):
(TestWebKitAPI::TEST_F(QuirksTest, ParsedQuirkTableMatchesCompiledTable)):
(TestWebKitAPI::TEST_F(QuirksTest, ShippedQuirkTableParsesWithoutErrors)):

Canonical link: https://commits.webkit.org/324338@main
…landed

https://bugs.webkit.org/show_bug.cgi?id=328246

Reviewed by Anne van Kesteren.

324246@main (bug 326324) landed with a local edit to the imported WPT at
LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-characterData.html,
changing the ProcessingInstruction oldValue expectation from "?processing data?"
to "data". The matching upstream fix landed shortly after as
web-platform-tests/wpt#63537, which replaces the
HTML-parsed PI with document.createProcessingInstruction and asserts "data"
directly, so the test no longer depends on the HTML PI parser flag.

Re-import the file byte-identical from upstream WPT so our tree stops carrying
the local hand-edit. The expected baseline is unchanged (still an all-pass
line for the ProcessingInstruction case).

* LayoutTests/imported/w3c/web-platform-tests/dom/nodes/MutationObserver-characterData.html:

Canonical link: https://commits.webkit.org/324339@main
https://bugs.webkit.org/show_bug.cgi?id=328130
rdar://181868527

Reviewed by Matt Woodrow.

Rendering resources are not automatically released on a critical memory
pressure notification. Since render targets and command queues might not
be needed imminently, we should tell CA to clean up resources.

Improves the PLUM memory benchmark by about 2% on iPhone 17 Pro Max.

* Source/WebCore/Configurations/AllowedSPI.toml:
* Source/WebCore/platform/graphics/cocoa/IOSurface.h:
* Source/WebCore/platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::releaseCGIOSurfaceContextResources):
* Source/WebKit/GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::lowMemoryHandler):

Canonical link: https://commits.webkit.org/324340@main
https://bugs.webkit.org/show_bug.cgi?id=328265
rdar://190560591

Reviewed by Cole Carley.

When Editor::findString(), Editor::findAllMatches(), or
Editor::countMatchesForText() is called such as via window.find(), Editor
lazily allocates a CachedMatchFinder. CachedMatchFinder caches TextRun vectors
and SimpleRange matches that hold strong references to DOM Nodes, which in turn
keep a Document alive. Because Document owns m_editor, this forms a strong
reference cycle (Document -> m_editor -> m_matchFinder -> Node -> Document).

Previously, Editor::clear(), called from Document::prepareForDestruction()
when a document detaches from its frame, did not reset m_matchFinder, and
releaseCriticalMemory() only called releaseMemory() on documents frames editor
when the document was still attached to a frame.

Fix this by clearing m_matchFinder in Editor::clear() and adding
Document::editorIfExists() so releaseCriticalMemory() releases Editor memory
directly on any Document, even if detached from a frame, that has an Editor.

Test: editing/text-iterator/window-find-does-not-leak.html

* LayoutTests/editing/text-iterator/resources/window-find-leak-test.html: Added.
* LayoutTests/editing/text-iterator/window-find-does-not-leak-expected.txt: Added.
* LayoutTests/editing/text-iterator/window-find-does-not-leak.html: Added.
* Source/WebCore/dom/Document.h:
(WebCore::Document::editorIfExists):
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::clear):
* Source/WebCore/page/MemoryRelease.cpp:
(WebCore::releaseCriticalMemory):

Canonical link: https://commits.webkit.org/324341@main
…irks.cpp

https://bugs.webkit.org/show_bug.cgi?id=328229

Unreviewed build fix.

The PlayStation stub returned early but left the readEntireFile() call
that uses `path` outside the platform guards, so `path` was undeclared.
Guard the whole non-PlayStation body.

* Tools/TestWebKitAPI/Tests/WebCore/Quirks.cpp:
(TestWebKitAPI::shippedQuirkTableJSON):

Canonical link: https://commits.webkit.org/324342@main
…size leaves repaint trails

https://bugs.webkit.org/show_bug.cgi?id=328280

Reviewed by Darin Adler.

322493@main made RenderImage::repaintOrMarkForLayout() map an image's changed rect using the image's natural
dimensions. An SVG image lays out at its concrete object size, so its changed rects are in that space, and an
animated SVG drawn smaller than its natural size repainted too little and left trails. RenderSVGImage did the
same, but LegacyRenderSVGImage doesn't have the issue as it always issues conservative repaints (something to
consider optimizing in the future if the legacy path is to stick around).

How an image's changed rects are interpreted depends on the specific Style::Image subclass. So, a new virtual
function is needed on Style::Image, mapChangedRectToSource(), that can perform the mapping for us. RenderImage
and RenderSVGImage then map from the concrete object size they paint with to the rect they paint into.

Also adds RenderImage::concreteObjectSizeForPainting() which is now shared by painting and repainting.

Test case by Dan Glastonbury.

Tests: svg/repaint/image-scaled-transform-animation-zoom.html
       svg/repaint/image-scaled-transform-animation.html
* LayoutTests/svg/repaint/image-scaled-transform-animation-expected.html: Added.
* LayoutTests/svg/repaint/image-scaled-transform-animation-zoom-expected.html: Added.
* LayoutTests/svg/repaint/image-scaled-transform-animation-zoom.html: Added.
* LayoutTests/svg/repaint/image-scaled-transform-animation.html: Added.
* LayoutTests/svg/resources/square-translate-bottom-right.svg: Added.
* Source/WebCore/rendering/RenderImage.cpp:
* Source/WebCore/rendering/RenderImage.h:
* Source/WebCore/rendering/svg/RenderSVGImage.cpp:
* Source/WebCore/style/values/images/kinds/StyleCachedImage.cpp:
* Source/WebCore/style/values/images/kinds/StyleCachedImage.h:
* Source/WebCore/style/values/images/kinds/StyleCanvasImage.cpp:
* Source/WebCore/style/values/images/kinds/StyleCanvasImage.h:
* Source/WebCore/style/values/images/kinds/StyleImage.cpp:
* Source/WebCore/style/values/images/kinds/StyleImage.h:
* Source/WebCore/style/values/images/kinds/StyleMultiImage.cpp:
* Source/WebCore/style/values/images/kinds/StyleMultiImage.h:

Canonical link: https://commits.webkit.org/324343@main
…size on 200% display scaling

https://bugs.webkit.org/show_bug.cgi?id=328226

Reviewed by Nikolas Zimmermann.

The cursor image scale factor is ignored when creating the GdkCursor.
For GTK3 we now use gdk_cursor_new_from_surface() so that we can set the
scale factor in the cairo surface with cairo_surface_set_device_scale().
For GTK4 we use gdk_cursor_new_from_callback() which allows to return a
GdkTexture with the physical size and report the logical size as output
parameters of the callback. This API is available since GTK 4.16 but was
buggy in wayland until it was fixed in 4.22, so we are only using it
when building with GTK >= 4.22. For previous versions we fallback to
re-scale the cursor image with skia to the expected scale, using the
same code as DragImageSkia that has been moved to a helper function
scaleImagePixels() in SkiaUtilities.

* Source/WebCore/platform/graphics/skia/SkiaUtilities.cpp:
(WebCore::SkiaUtilities::scaleImagePixels):
* Source/WebCore/platform/graphics/skia/SkiaUtilities.h:
* Source/WebCore/platform/skia/DragImageSkia.cpp:
(WebCore::scaleDragImage):
* Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseSetCursor):

Canonical link: https://commits.webkit.org/324344@main
https://bugs.webkit.org/show_bug.cgi?id=328181
rdar://190507848

Reviewed by Mike Wyrzykowski.

WebGPU.h of WebGPU.framework is now the webgpu.h of Dawn that ANGLE
builds with, Source/ThirdParty/ANGLE/WebKit/dawn/webgpu.h. The C API
entry points and their conversions follow its layout: string views,
futures with callback infos, pointer and size arguments, status results,
the _Undefined defaults and _BindingNotUsed of its enums, and chained
structs for external textures and the maximum draw count.

The futures are kept by the instance, and wgpuInstanceWaitAny runs the
pending work of the instance until one of them has completed.
wgpuAdapterGetInfo allocates the strings that wgpuAdapterInfoFreeMembers
frees, and wgpuDeviceGetQueue returns a new reference.

* Source/WebGPU/WebGPU/APIConversions.h:
(WebGPU::Metal::toAPI):
(WebGPU::Metal::toAPIAllocated):
(WebGPU::Metal::freeAllocated):
(WebGPU::Metal::CAPIFuture::CAPIFuture):
(WebGPU::Metal::CAPIFuture::future const):
(WebGPU::Metal::CAPIFuture::complete const):
* Source/WebGPU/WebGPU/Adapter.mm:
(wgpuAdapterGetLimits):
(wgpuAdapterGetInfo):
(wgpuAdapterInfoFreeMembers):
(wgpuAdapterRequestDevice):
(requestDevice): Deleted.
* Source/WebGPU/WebGPU/Buffer.mm:
(wgpuBufferGetMappedRange):
(wgpuBufferGetConstMappedRange):
(wgpuBufferMapAsync):
(mapAsyncStatusToAPI): Deleted.
* Source/WebGPU/WebGPU/CommandEncoder.mm:
(wgpuCommandEncoderFinish):
* Source/WebGPU/WebGPU/ComputePassEncoder.mm:
(wgpuComputePassEncoderSetBindGroup):
* Source/WebGPU/WebGPU/Device.mm:
* Source/WebGPU/WebGPU/Instance.h:
* Source/WebGPU/WebGPU/Instance.mm:
(WebGPU::Metal::Instance::defaultScheduleWork):
(WebGPU::Metal::Instance::createFuture):
(WebGPU::Metal::Instance::completeFuture):
(WebGPU::Metal::Instance::waitForAnyFuture):
(WebGPU::Metal::Instance::anyFutureCompleted):
(wgpuCreateInstance):
(wgpuGetProcAddress):
(wgpuInstanceRequestAdapter):
(wgpuInstanceWaitAny):
(requestAdapter): Deleted.
* Source/WebGPU/WebGPU/Queue.mm:
* Source/WebGPU/WebGPU/RenderPassEncoder.mm:
(wgpuRenderPassEncoderSetBindGroup):
* Source/WebGPU/WebGPU/ShaderModule.mm:
(getCompilationInfo):
(wgpuShaderModuleGetCompilationInfo):
* Source/WebGPU/WebGPU/WebGPU.h:
* Source/WebGPU/WebGPU/WebGPUCppConversions.h:
(WebGPU::Metal::fromAPI):
(WebGPU::Metal::toAPI):
(WebGPU::Metal::textureUsageFromAPI):
(WebGPU::Metal::entryPointFromAPI):
(WebGPU::Metal::programmableStageFromAPI):
(WebGPU::Metal::renderPassAttachmentViewFromAPI):
* Source/WebGPU/WebGPU/WebGPUExt.h:
* Source/WebGPU/WebGPU/config.h:

Canonical link: https://commits.webkit.org/324345@main
https://bugs.webkit.org/show_bug.cgi?id=328185
rdar://190510529

Reviewed by Dan Glastonbury.

When the GPU stops a draw that runs for too long, ANGLE Metal marks the
command queue of the display as lost. WebKit created the contexts without
a reset notification strategy, so glGetGraphicsResetStatusEXT() always
returned NO_ERROR, and only a simulated GPU failure lost the context. The
page kept drawing to a context that silently dropped all work.

Restoring the context would not have worked either. ANGLE shares one
EGLDisplay between all the contexts that are created with the same display
attributes, and a lost Metal display stays lost: contexts cannot be created
on it.

Create the contexts with EGL_LOSE_CONTEXT_ON_RESET_EXT, and check the reset
status after the draws and clears, before displaying the context and before
destroying it. On a reset, lose the context and increment the
EGL_PLATFORM_ANGLE_DISPLAY_KEY_ANGLE that new contexts pass, so that the
contexts created after the reset, including the restored ones, use a new
display.

A context can be created before any context noticed the reset. Creating it
on the lost display fails with EGL_CONTEXT_LOST or EGL_BAD_DISPLAY. Then
increment the key and create the context once more, on a new display. This
way the contexts work after a reset regardless of which context notices
the reset first.

Count the contexts of each display. A display of an older key is
terminated when its last context is destroyed. The display key, the
initialization of the display and the counts are protected by one lock.
The display is terminated outside the lock, as a display of an older key is
not handed out again. In the GPU process nothing else terminates the
displays.

Create the video copy context with the same reset notification strategy as
the context it shares state with, as EGL requires.

Make the simulated GPU failure lose the ANGLE context with
GL_LoseContextCHROMIUM, so that the context notices it like a real reset.
The simulated failure loses only the context, not the display or the other
contexts of the display.

After the ANGLE context is lost, ANGLE reports the calls as GL_CONTEXT_LOST
errors in the debug messages. Do not pass these to the page, as the context
loss is reported with forceContextLost(). WebGLRenderingContextBase also
had its own copy of GraphicsContextGL::enumToErrorCode() that did not
handle GL_CONTEXT_LOST. Use GraphicsContextGL::enumToErrorCode().

Tests: webgl/context-lost-gpu-reset-long-fragment-shader.html
       webgl/context-lost-gpu-reset-long-vertex-shader.html
       webgl/context-lost-gpu-reset-simulated.html
       Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm

The long-shader layout tests and the DISABLED_GPUReset* API tests cause a
real GPU failure with a draw whose shader does not terminate in a
reasonable time, so they are skipped and disabled. Run them manually with
run-webkit-tests --force and run-api-tests --force. The other tests
simulate the GPU failure.

* LayoutTests/TestExpectations:
* LayoutTests/webgl/context-lost-gpu-reset-long-fragment-shader-expected.txt: Added.
* LayoutTests/webgl/context-lost-gpu-reset-long-fragment-shader.html: Added.
* LayoutTests/webgl/context-lost-gpu-reset-long-vertex-shader-expected.txt: Added.
* LayoutTests/webgl/context-lost-gpu-reset-long-vertex-shader.html: Added.
* LayoutTests/webgl/context-lost-gpu-reset-simulated-expected.txt: Added.
* LayoutTests/webgl/context-lost-gpu-reset-simulated.html: Added.
* LayoutTests/webgl/resources/context-lost-gpu-reset.js: Added.
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::addDebugMessage):
(WebCore::glEnumToErrorCode): Deleted.
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::initialize):
(WebCore::GraphicsContextGLANGLE::simulateEventForTesting):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h:
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.h:
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::displayContextCounts):
(WebCore::didLoseDisplay):
(WebCore::releaseDisplay):
(WebCore::initializeEGLDisplay):
(WebCore::GraphicsContextGLCocoa::platformInitializeContext):
(WebCore::GraphicsContextGLANGLE::~GraphicsContextGLANGLE):
(WebCore::GraphicsContextGLCocoa::isDisplayInitializedForTesting):
(WebCore::GraphicsContextGLANGLE::checkGPUStatus):
(WebCore::GraphicsContextGLCocoa::prepareForDisplayWithFinishedSignal):
* Source/WebCore/platform/graphics/cv/GraphicsContextGLCVCocoa.mm:
(WebCore::GraphicsContextGLCVCocoa::GraphicsContextGLCVCocoa):
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm:
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, ContextsLoseContextOnReset)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, GPUResetCreatesNewDisplay)):
(TestWebKitAPI::createGPUResetTestContext):
(TestWebKitAPI::drawUntilGPUReset):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, DISABLED_GPUResetThenCreateContext)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, DISABLED_GPUResetThenDestroyContext)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, DISABLED_GPUResetThenPrepareForDisplay)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, DISABLED_GPUResetThenReshape)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, DISABLED_GPUResetLosesOtherContexts)):
(TestWebKitAPI::simulateGPUReset):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, SimulatedGPUResetThenCreateContext)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, SimulatedGPUResetThenDestroyContext)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, SimulatedGPUResetThenPrepareForDisplay)):
(TestWebKitAPI::TEST_F(GraphicsContextGLCocoaTest, SimulatedGPUResetThenReshape)):

Canonical link: https://commits.webkit.org/324346@main
… debugger steps

https://bugs.webkit.org/show_bug.cgi?id=327425
rdar://189930833

Reviewed by Sihui Liu.

With SiteIsolationGlobalDebuggerPauseEnabled, a paused frame holds the frames of its page in
other WebContent processes through the pause session coordinator
(https://bugs.webkit.org/show_bug.cgi?id=326737). The end of the pause was reported from
FrameDebugger::didContinue, as soon as the nested run loop exited, so every step closed the
session and the next pause opened a new one, and the frames in other processes ran between steps.

DebuggerSuspensionController now reports the end of a pause when the VM goes idle, and drops the
report if the same frame pauses again first. Every step either pauses again or ends at VM idle,
which is also where InspectorDebuggerAgent sends the frontend "resumed" for a step, so no
stepping signal from JSC or the agent is needed. JSC::Debugger::isStepping() could not tell a
step from a resume anyway, since stepping mode is turned off only after handlePause() returns.

- A step that stops at the next statement keeps the session open.
- A step that leaves the VM, over an await or out of the outermost frame, still ends it, so an
  await that depends on a frame in another process can settle.
- If another frame of the process pauses first, the earlier pause is reported as ended right
  after the new one is reported, so the session stays open.
- The pausing process still releases its own hold when the frame continues.
- While the report waits for VM idle, a paused frame that leaves its process or is removed is
  still dropped from the session by the UI process (https://bugs.webkit.org/show_bug.cgi?id=327427).
- After a plain resume, the frames in other processes run again when the resumed task finishes
  rather than right away. Without site isolation they could not run during that time either.

pause-holds-cross-process-frames-while-stepping.html steps over two busy statements in the main
frame and checks that a cross-site iframe does not run during either step; both checks fail
without this change. It also steps over an await that the iframe resolves and expects the
iframe's reply to arrive, and steps out of the outermost frame and expects the iframe to run
again. The await case does not check the pause after the await: JavaScriptCore abandons that pause
when the await takes more than a second, which the round trip through the held iframe can take on
a loaded bot. Last, it resumes the main frame into a pause in a same-site iframe and checks that
the cross-site iframe stays held during that pause and runs again after it; without the report of
the first pause's end when the second one starts, the cross-site iframe stays held for good.

* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-cross-process-frames-while-stepping-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/inspector/debugger/pause-holds-cross-process-frames-while-stepping.html: Added.
* LayoutTests/http/tests/site-isolation/inspector/debugger/resources/replying-frame.html: Added.
* Source/WebCore/inspector/DebuggerSuspensionController.cpp:
(WebCore::pausedFrame):
(WebCore::reportFrameDebuggerDidContinue):
(WebCore::DebuggerSuspensionController::frameDebuggerDidPause):
(WebCore::DebuggerSuspensionController::frameDebuggerDidContinue):
(WebCore::pausedPage): Deleted.

Canonical link: https://commits.webkit.org/324347@main
syg and others added 10 commits October 22, 2026 17:07
https://bugs.webkit.org/show_bug.cgi?id=328553

Reviewed by Marcus Plutowski, Yusuke Suzuki, and Keith Miller.

Mark myself as a reviewer.

* metadata/contributors.json:

Canonical link: https://commits.webkit.org/324503@main
rdar://190737340
https://bugs.webkit.org/show_bug.cgi?id=328496

Reviewed by Basuke Suzuki.

Stopwatch::reset() kept the list of earlier run intervals, so
fromMonotonicTime() mapped times from before the reset onto the new
zero point, and shifted times from later runs by the length of the old
intervals. A debugger pause adds an interval, and
InspectorPageAgent::enable() and WorkerInspectorController reset the
stopwatch afterwards, so this can happen. Clear the list in reset().

Drive-by: also rename the misspelt m_pastInternals to m_pastIntervals.

Test: Tools/TestWebKitAPI/Tests/WTF/Stopwatch.cpp

* Source/WTF/wtf/Stopwatch.h:
(WTF::Stopwatch::reset):
(WTF::Stopwatch::stop):
(WTF::Stopwatch::fromMonotonicTime const):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WTF/Stopwatch.cpp: Added.
(TestWebKitAPI::TEST(WTF_Stopwatch, ResetForgetsTimesFromRunsBeforeTheReset)):
(TestWebKitAPI::TEST(WTF_Stopwatch, TimesAfterResetAreRelativeToTheNewStart)):

Canonical link: https://commits.webkit.org/324504@main
https://bugs.webkit.org/show_bug.cgi?id=328490
rdar://190730064

Reviewed by Ryosuke Niwa.

A cross-origin no-cors response from the network that Document-Isolation-Policy
or Document-Isolation-Policy-Report-Only blocks now queues a "dip" report.
ReportingObserver can observe it, and it goes to the report-to endpoint if there
is one. Its body is that of a Cross-Origin-Embedder-Policy CORP violation,
without the blocked URL's fragment, as Fetch's serialize a response URL for
reporting requires.

The network process now gets a load's whole policy rather than just its value,
since it needs the report-only value and the endpoints.

A response that Cross-Origin-Embedder-Policy and Document-Isolation-Policy both
block gets a report for each, as the specification's "blocked-by-coep-and-dip"
result requires. Unlike the specification, an enforced policy also reports what
it blocks without a report-only policy, see
WICG/document-isolation-policy#10

Not covered yet, also for Cross-Origin-Embedder-Policy:
- The loads of a dedicated worker report to its owner document rather than to
  the worker.
- Memory cache hits, service worker responses, and the Cache API queue no
  reports.

reporting-subresource-corp.tentative.https.html now passes its document cases,
but like reporting-cache-storage-corp.tentative.https.html it still times out,
so both stay skipped.

Tests: imported/w3c/web-platform-tests/html/document-isolation-policy/reporting.tentative.https.html
Canonical link: https://commits.webkit.org/324505@main
https://bugs.webkit.org/show_bug.cgi?id=328541
rdar://190759581

Reviewed by Keith Miller.

We are creating SourceCode just to read taintedness. Avoid creating it.

* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/runtime/FunctionPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/IntlCollatorPrototype.cpp:
(JSC::JSC_DEFINE_CUSTOM_GETTER):
* Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::JSC_DEFINE_CUSTOM_GETTER):
* Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp:
(JSC::JSC_DEFINE_CUSTOM_GETTER):
* Source/JavaScriptCore/runtime/JSBoundFunction.cpp:
(JSC::JSBoundFunction::create):
(JSC::JSBoundFunction::createRaw):
(JSC::JSBoundFunction::JSBoundFunction):
* Source/JavaScriptCore/runtime/JSBoundFunction.h:

Canonical link: https://commits.webkit.org/324506@main
…CustomColorModeEnabled' not found on object of type 'WKPreferences *'

rdar://190771970

Unreviewed build fix.

WKWebViewContentInversion.mm uses -[WKPreferences _axCustomColorModeEnabled] but did not import
WKPreferencesPrivate.h; it relied on an earlier file in its unified source bundle to provide it.
Adding PresentationIntents.mm to SourcesCocoa.txt in 324486@main shifted the test to the start of
a new bundle, exposing the missing import.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewContentInversion.mm:

Canonical link: https://commits.webkit.org/324507@main
https://bugs.webkit.org/show_bug.cgi?id=328584

Unreviewed test gardening.

Rebaseline 60 svg/W3C-SVG-1.1 tests on the WPE Legacy API after 324088@main,
add expectations for new flaky tests and crashes, widen existing ones, and
remove ipc/serialized-type-info.html now that 324431@main was reverted.
See the bug for the details.

* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/wpe-legacy-api/svg/W3C-SVG-1.1/*-expected.txt: (60 files)
* LayoutTests/platform/wpe/TestExpectations:

Canonical link: https://commits.webkit.org/324508@main
https://webkit.org/b/328590
rdar://problem/190768385

Reviewed by Devin Rousso.

WI.DebuggerManager.scriptDidParse() gives every script with an execution context a parentFrame, and the
parentFrame branch in WI.SourcesNavigationSidebarPanel._addScript() only adds a tree element in "By Path"
mode. Extension content scripts run in a frame, so they were never added to "Extension Scripts" in "By
Type" mode. Let injected scripts skip that branch and reach the existing folder handling.

No automated test: the Sources sidebar is not part of the layout test frontend.

* Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel.prototype._addScript): Only take the parentFrame branch for scripts that
are not injected.
(WI.SourcesNavigationSidebarPanel.prototype._removeScript): Ditto.

Canonical link: https://commits.webkit.org/324509@main
https://bugs.webkit.org/show_bug.cgi?id=328529
rdar://190751511

Reviewed by Marcus Plutowski.

We never enabled this feature so far, and we think that, if we need
this, we should make it much more efficiently (encoding of BigInt32
looks not so great in terms of performance). Let's remove them.

* JSTests/stress/big-int-32-parsing-should-be-precise.js: Removed.
* JSTests/stress/bigint-inc-dec-in-place.js:
* JSTests/stress/heap-and-32-bigint-eq.js: Removed.
* JSTests/stress/heap-and-32-bigint-stricteq.js: Removed.
* JSTests/stress/heap-bigint-dfg-ftl-arith-bitwise-compare.js:
* JSTests/stress/load-varargs-typed-array.js:
(test):
* LayoutTests/fast/dom/Window/window-postmessage-clone-expected.txt:
* LayoutTests/fast/dom/Window/window-postmessage-clone.html:
* LayoutTests/platform/gtk/fast/dom/Window/window-postmessage-clone-expected.txt:
* Source/JavaScriptCore/API/JSValueRef.cpp:
(JSBigIntCreateWithDouble):
(JSBigIntCreateWithUInt64):
(JSBigIntCreateWithInt64):
* Source/JavaScriptCore/bytecode/ArithProfile.cpp:
(JSC::ArithProfile<BitfieldType>::emitObserveResult):
(WTF::printInternal):
(JSC::ArithProfile<BitfieldType>::shouldEmitSetBigInt32 const): Deleted.
(JSC::ArithProfile<BitfieldType>::emitSetBigInt32 const): Deleted.
* Source/JavaScriptCore/bytecode/ArithProfile.h:
(JSC::ObservedResults::didObserveNonInt32):
(JSC::ObservedResults::didObserveNonNumeric):
(JSC::ObservedResults::didObserveHeapBigInt):
(JSC::ArithProfile::didObserveNonNumeric const):
(JSC::ArithProfile::didObserveHeapBigInt const):
(JSC::ArithProfile::setObservedHeapBigInt):
(JSC::ArithProfile::observeResult):
(JSC::ObservedResults::didObserveBigInt): Deleted.
(JSC::ObservedResults::didObserveBigInt32): Deleted.
(JSC::ArithProfile::didObserveBigInt const): Deleted.
(JSC::ArithProfile::didObserveBigInt32 const): Deleted.
(JSC::ArithProfile::setObservedBigInt32): Deleted.
* Source/JavaScriptCore/bytecode/BytecodeList.rb:
* Source/JavaScriptCore/bytecode/BytecodeUseDef.cpp:
(JSC::computeUsesForBytecodeIndexImpl):
(JSC::computeDefsForBytecodeIndexImpl):
* Source/JavaScriptCore/bytecode/DataFormat.h:
(JSC::dataFormatToString):
* Source/JavaScriptCore/bytecode/ExitKind.h:
* Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h:
* Source/JavaScriptCore/bytecode/SpeculatedType.cpp:
(JSC::dumpSpeculation):
(JSC::speculationFromValueImpl):
* Source/JavaScriptCore/bytecode/SpeculatedType.h:
(JSC::isBigInt32Speculation): Deleted.
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitEqualityOpImpl):
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::makeSafe):
(JSC::DFG::ByteCodeParser::makeDivSafe):
(JSC::DFG::ByteCodeParser::parseBlock):
* Source/JavaScriptCore/dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::isZeroBigInt):
(JSC::DFG::isNegativeBigInt):
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* Source/JavaScriptCore/dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::fixupToThis):
(JSC::DFG::FixupPhase::fixupToNumberOrToNumericOrCallNumberConstructor):
(JSC::DFG::FixupPhase::observeUseKindOnNode):
(JSC::DFG::FixupPhase::fixupNormalizeMapKey):
(JSC::DFG::FixupPhase::fixupCompareStrictEqAndSameValue):
* Source/JavaScriptCore/dfg/DFGGraph.h:
* Source/JavaScriptCore/dfg/DFGNode.h:
(JSC::DFG::Node::mayHaveBigIntResult):
(JSC::DFG::Node::canSpeculateInt52):
(JSC::DFG::Node::mayHaveBigInt32Result): Deleted.
(JSC::DFG::Node::shouldSpeculateBigInt32): Deleted.
(JSC::DFG::Node::canSpeculateBigInt32): Deleted.
* Source/JavaScriptCore/dfg/DFGNodeFlags.cpp:
(JSC::DFG::dumpNodeFlags):
* Source/JavaScriptCore/dfg/DFGNodeFlags.h:
(JSC::DFG::nodeMayHaveHeapBigInt): Deleted.
(JSC::DFG::nodeCanSpeculateBigInt32): Deleted.
* Source/JavaScriptCore/dfg/DFGNodeType.h:
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp:
* Source/JavaScriptCore/dfg/DFGSafeToExecute.h:
(JSC::DFG::SafeToExecuteEdge::operator()):
(JSC::DFG::safeToExecute):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compilePeepHoleBranch):
(JSC::DFG::SpeculativeJIT::checkGeneratedTypeForToInt32):
(JSC::DFG::SpeculativeJIT::compileValueToInt32):
(JSC::DFG::SpeculativeJIT::compileValueBitNot):
(JSC::DFG::SpeculativeJIT::emitUntypedBitOp):
(JSC::DFG::SpeculativeJIT::compileValueBitwiseOp):
(JSC::DFG::SpeculativeJIT::emitUntypedOrBigIntRightShiftBitOp):
(JSC::DFG::SpeculativeJIT::compileValueLShiftOp):
(JSC::DFG::SpeculativeJIT::compileValueBitRShift):
(JSC::DFG::SpeculativeJIT::compileValueAdd):
(JSC::DFG::SpeculativeJIT::compileValueSub):
(JSC::DFG::SpeculativeJIT::compileValueNegate):
(JSC::DFG::SpeculativeJIT::compileValueMul):
(JSC::DFG::SpeculativeJIT::compileValueDiv):
(JSC::DFG::SpeculativeJIT::compileValueMod):
(JSC::DFG::SpeculativeJIT::compileValuePow):
(JSC::DFG::SpeculativeJIT::compare):
(JSC::DFG::SpeculativeJIT::compileStrictEq):
(JSC::DFG::SpeculativeJIT::speculateNotCellNorBigInt):
(JSC::DFG::SpeculativeJIT::speculate):
(JSC::DFG::SpeculativeJIT::compileToNumeric):
(JSC::DFG::SpeculativeJIT::compileCallNumberConstructor):
(JSC::DFG::SpeculativeJIT::genericJSValueNonPeepholeCompare):
(JSC::DFG::SpeculativeJIT::emitUntypedOrAnyBigIntBitOp): Deleted.
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculateBigInt32Operand::SpeculateBigInt32Operand): Deleted.
(JSC::DFG::SpeculateBigInt32Operand::~SpeculateBigInt32Operand): Deleted.
(JSC::DFG::SpeculateBigInt32Operand::edge const): Deleted.
(JSC::DFG::SpeculateBigInt32Operand::node const): Deleted.
(JSC::DFG::SpeculateBigInt32Operand::gpr): Deleted.
(JSC::DFG::SpeculateBigInt32Operand::use): Deleted.
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::fillJSValue):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeStrictEq):
(JSC::DFG::SpeculativeJIT::genericJSValueNonPeepholeStrictEq):
(JSC::DFG::SpeculativeJIT::fillSpeculateInt32Internal):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
(JSC::DFG::SpeculativeJIT::emitUntypedBranch):
(JSC::DFG::SpeculativeJIT::compileMapGetImpl):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::speculateBigInt32): Deleted.
(JSC::DFG::SpeculativeJIT::speculateAnyBigInt): Deleted.
(JSC::DFG::SpeculativeJIT::fillSpeculateBigInt32): Deleted.
(JSC::DFG::SpeculativeJIT::compileBigInt32Compare): Deleted.
(JSC::DFG::SpeculativeJIT::compilePeepHoleBigInt32Branch): Deleted.
* Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:
(JSC::DFG::StrengthReductionPhase::handleNode):
* Source/JavaScriptCore/dfg/DFGUseKind.cpp:
(WTF::printInternal):
* Source/JavaScriptCore/dfg/DFGUseKind.h:
(JSC::DFG::typeFilterFor):
* Source/JavaScriptCore/ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* Source/JavaScriptCore/ftl/FTLCommonValues.cpp:
(JSC::FTL::CommonValues::initializeConstants):
* Source/JavaScriptCore/ftl/FTLCommonValues.h:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileValueAdd):
(JSC::FTL::DFG::LowerDFGToB3::compileValueSub):
(JSC::FTL::DFG::LowerDFGToB3::compileValueMul):
(JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC):
(JSC::FTL::DFG::LowerDFGToB3::compileValueDiv):
(JSC::FTL::DFG::LowerDFGToB3::compileValueMod):
(JSC::FTL::DFG::LowerDFGToB3::compileValuePow):
(JSC::FTL::DFG::LowerDFGToB3::compileValueBitNot):
(JSC::FTL::DFG::LowerDFGToB3::compileValueBitAnd):
(JSC::FTL::DFG::LowerDFGToB3::compileValueBitOr):
(JSC::FTL::DFG::LowerDFGToB3::compileValueBitXor):
(JSC::FTL::DFG::LowerDFGToB3::compileValueBitRShift):
(JSC::FTL::DFG::LowerDFGToB3::compileValueBitLShift):
(JSC::FTL::DFG::LowerDFGToB3::compileToNumeric):
(JSC::FTL::DFG::LowerDFGToB3::compileCallNumberConstructor):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareEq):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
(JSC::FTL::DFG::LowerDFGToB3::compileSwitch):
(JSC::FTL::DFG::LowerDFGToB3::compileMapHash):
(JSC::FTL::DFG::LowerDFGToB3::compileMapGetImpl):
(JSC::FTL::DFG::LowerDFGToB3::numberOrNotCellNorBigIntToInt32):
(JSC::FTL::DFG::LowerDFGToB3::compare):
(JSC::FTL::DFG::LowerDFGToB3::emitBinaryBitOpSnippet):
(JSC::FTL::DFG::LowerDFGToB3::boolify):
(JSC::FTL::DFG::LowerDFGToB3::buildTypeOf):
(JSC::FTL::DFG::LowerDFGToB3::allocateHeapBigInt64):
(JSC::FTL::DFG::LowerDFGToB3::isCellOrMisc):
(JSC::FTL::DFG::LowerDFGToB3::isNotCellOrMisc):
(JSC::FTL::DFG::LowerDFGToB3::isNumber):
(JSC::FTL::DFG::LowerDFGToB3::isNotNumber):
(JSC::FTL::DFG::LowerDFGToB3::speculate):
(JSC::FTL::DFG::LowerDFGToB3::speculateNotCellNorBigInt):
* Source/JavaScriptCore/jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::emitConvertValueToBoolean):
(JSC::AssemblyHelpers::branchIfValue):
* Source/JavaScriptCore/jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitTypeOf):
(JSC::AssemblyHelpers::branchIfBigInt32): Deleted.
(JSC::AssemblyHelpers::branchIfNotBigInt32): Deleted.
(JSC::AssemblyHelpers::unboxBigInt32): Deleted.
(JSC::AssemblyHelpers::boxBigInt32): Deleted.
* Source/JavaScriptCore/jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* Source/JavaScriptCore/jit/JIT.h:
* Source/JavaScriptCore/jit/JITOpcodes.cpp:
(JSC::JIT::compileOpStrictEq):
(JSC::JIT::compileOpStrictEqJump):
(JSC::JIT::emit_op_is_big_int): Deleted.
* Source/JavaScriptCore/jit/JITOperations.cpp:
(JSC::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/jit/JITOperations.h:
* Source/JavaScriptCore/jsc.cpp:
(JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h:
* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/lol/LOLJIT.cpp:
(JSC::LOL::LOLJIT::privateCompileMainPass):
(JSC::LOL::LOLJIT::privateCompileSlowCases):
(JSC::LOL::LOLJIT::emit_op_is_big_int): Deleted.
* Source/JavaScriptCore/lol/LOLJIT.h:
* Source/JavaScriptCore/lol/LOLRegisterAllocator.h:
* Source/JavaScriptCore/parser/ParserArena.cpp:
(JSC::IdentifierArena::makeBigIntDecimalIdentifier):
* Source/JavaScriptCore/runtime/BigIntConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/BigIntPrototype.cpp:
(JSC::toThisBigIntValue):
* Source/JavaScriptCore/runtime/CloneDeserializerBase.h:
(JSC::CloneDeserializerBase::readBigInt):
* Source/JavaScriptCore/runtime/CloneSerializerBase.h:
(JSC::CloneSerializerBase::dumpBigIntData):
(JSC::CloneSerializerBase::dumpBigInt32Data): Deleted.
* Source/JavaScriptCore/runtime/CommonSlowPaths.cpp:
(JSC::updateArithProfileForUnaryArithOp):
(JSC::JSC_DEFINE_COMMON_SLOW_PATH):
(JSC::updateArithProfileForBinaryArithOp):
* Source/JavaScriptCore/runtime/HashMapHelper.h:
(JSC::normalizeMapKey):
* Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:
(JSC::IntlMathematicalValue::parseString):
* Source/JavaScriptCore/runtime/JSBigInt.cpp:
(JSC::zeroImpl):
(JSC::JSBigInt::exponentiate):
(JSC::JSBigInt::multiply):
(JSC::JSBigInt::divide):
(JSC::JSBigInt::unaryMinus):
(JSC::JSBigInt::sqrt):
(JSC::JSBigInt::cbrt):
(JSC::JSBigInt::remainder):
(JSC::JSBigInt::inc):
(JSC::JSBigInt::decImpl):
(JSC::JSBigInt::dec):
(JSC::JSBigInt::add):
(JSC::JSBigInt::sub):
(JSC::JSBigInt::bitwiseAnd):
(JSC::JSBigInt::bitwiseOr):
(JSC::JSBigInt::bitwiseXor):
(JSC::JSBigInt::leftShift):
(JSC::JSBigInt::signedRightShift):
(JSC::JSBigInt::bitwiseNot):
(JSC::JSBigInt::compare):
(JSC::JSBigInt::parseInt):
(JSC::JSBigInt::compareToDouble):
(JSC::JSBigInt::asIntN):
(JSC::JSBigInt::asUintN):
(JSC::tryConvertToBigInt32): Deleted.
(JSC::JSBigInt::leftShiftSlow): Deleted.
* Source/JavaScriptCore/runtime/JSBigInt.h:
(JSC::tryConvertToBigInt32): Deleted.
* Source/JavaScriptCore/runtime/JSBigIntInlines.h:
(JSC::JSBigInt::toNumber):
(JSC::JSBigInt::toBigUInt64):
(JSC::JSBigInt::toBigInt64):
(JSC::JSBigInt::tryExtractDouble):
(JSC::JSBigInt::makeHeapBigIntOrBigInt32): Deleted.
* Source/JavaScriptCore/runtime/JSCJSValue.cpp:
(JSC::JSValue::toNumberSlowCase const):
(JSC::JSValue::toBigInt const):
(JSC::JSValue::toObjectSlowCase const):
(JSC::JSValue::toThisSloppySlowCase const):
(JSC::JSValue::synthesizePrototype const):
(JSC::JSValue::dumpInContextAssumingStructure const):
(JSC::JSValue::dumpForBacktrace const):
(JSC::JSValue::toStringSlowCase const):
* Source/JavaScriptCore/runtime/JSCJSValue.h:
(JSC::jsBigInt32): Deleted.
(JSC::JSValue::isBigInt32 const): Deleted.
(JSC::JSValue::bigInt32AsInt32 const): Deleted.
* Source/JavaScriptCore/runtime/JSCJSValueCell.h:
(JSC::JSValue::isBigInt const):
(JSC::JSValue::toBoolean const):
* Source/JavaScriptCore/runtime/JSCJSValueInlines.h:
(JSC::JSValue::equalSlowCaseInline):
(JSC::JSValue::strictEqual):
(JSC::JSValue::pureStrictEqual):
(JSC::JSValue::pureToBoolean const):
* Source/JavaScriptCore/runtime/JSStringJoiner.h:
(JSC::JSStringJoiner::appendWithoutSideEffects):
* Source/JavaScriptCore/runtime/Operations.h:
* Source/JavaScriptCore/runtime/OperationsInlines.h:
(JSC::compareBigInt):
(JSC::compareBigIntToOtherPrimitive):
(JSC::bigIntCompare):
(JSC::arithmeticBinaryOp):
(JSC::jsInc):
(JSC::jsDec):
(JSC::jsBitwiseNot):
(JSC::shift):
(JSC::bitwiseBinaryOp):
(JSC::jsBitwiseAnd):
(JSC::jsBitwiseOr):
(JSC::jsBitwiseXor):
(JSC::compareBigInt32ToOtherPrimitive): Deleted.
* Source/JavaScriptCore/runtime/TemporalInstant.cpp:
(JSC::bigIntValueToExactTime):
* Source/JavaScriptCore/runtime/TypedArrayAdaptors.h:
(JSC::BigIntTypedArrayAdaptor::toJSValue):
* Source/JavaScriptCore/wasm/WasmGlobal.cpp:
(JSC::Wasm::Global::get const):
* Source/JavaScriptCore/wasm/WasmOperations.cpp:
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
* Source/WTF/wtf/PlatformUse.h:

Canonical link: https://commits.webkit.org/324510@main
193 upstream commits since 33ce3bf (the previous upgrade, #860), 37 of
them in Source/JavaScriptCore, Source/WTF or Source/bmalloc.

This records upstream/main as a parent, so the next upgrade finds its base by
itself as long as this lands as a merge commit and not as a squash.

5 files conflicted, one hunk each. JSType.h, .github/, the Dockerfiles and the
WebCore bindings scripts are untouched. BytecodeList.rb loses op_is_big_int, so
the serialized bytecode changes.

ArrayMode::refine (1af9d48)

  Upstream no longer falls back to Array::Generic on an ExoticObjectMode exit
  site when the mode is a JSArray, because ArrayPush and ArrayUnshift cannot be
  Generic. The fork had added SparseIndex (76c588a) to the same condition.
  The exemption applies to ExoticObjectMode only: SparseIndex exists for
  JSArrays, and behind !isJSArray()
  stress/arrayify-should-not-keep-exiting-for-sparse-index.js recompiles without
  end. Only an Arrayify with an index child raises SparseIndex. ArrayPush and
  ArrayUnshift pass no index and no call intrinsic emits a node that does, so
  such an exit does not share an origin with them.

BigInt32 (f59345e)

  Removed upstream. It was never enabled, so nothing changes at run time.
  - BytecodeGenerator.cpp (conflict): the fork's
    replaceLastInstruction<OpIsCellWithType>(), without the USE(BIGINT32) arm.
  The rest merged without a conflict and no longer compiled, or was dead:
  - makeHeapBigIntOrBigInt32() is createFrom(), which is all it did:
    ffi/FFIConversions.cpp, ffi/tests/testFFI.cpp, tools/JSDollarVM.cpp.
  - BytecodeOptimizer.cpp: no case op_is_big_int.
  - JSBigInt.cpp, the linear-time parseInt: lengthLimitForBigInt32 is
    lengthLimitForInt32. A rename; the values are those of the old #else arm.
  - DFGSpeculativeJIT64.cpp, BufferReadInt: the USE(BIGINT32) arm is removed.
  The two USE(BIGINT32) blocks left in JSBigInt.cpp are upstream's.

The other conflicts

  - jsc.cpp (cf08eff): both, the fork's functionDollarIsRemoteFunction and
    upstream's maxLiveAgentsInFuzzerMode.
  - JSBoundFunction.h (e50f025): the fork's quoted includes, plus
    "SourceTaintedness.h".
  - CMakeLists.txt (91fb668): both headers, HasOwnPropertyCacheInlines.h
    and the fork's HashMapHelper.h.

Tests

  - LayoutTests/js/let-syntax-expected.txt (926bafc): the two lines
    upstream added say "Can't find variable: x"; the fork prints
    "x is not defined" (A1 in JSTests/BUN-TEST-DIFFERENCES.md).

Heap versions (e1a28d3, d2a655b)

  MarkedSpace::initialVersion is 1, so a block at nullVersion is one version
  behind a heap at initialVersion. Nothing of the fork needed a change:
  decommitUnusedPages() asks upstream's staleMarksStillRecordSurvivors() rather
  than repeating it, and m_lastAuxiliaryEvacuationVersion and
  m_markingVersionAtLastSweep are only compared for equality with the heap's
  version, which still is never 0.
Comment on lines +563 to +566
if (!m_checkedForBOM) {
m_buffer.append(data);
return emptyString();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (optional) Web extensions whose JSON, JS or text resource is 1 or 2 bytes now get an empty string for it instead of its contents. TextResourceDecoder::decode at Source/WebCore/loader/TextResourceDecoder.cpp:565 now buffers the data and returns emptyString() until 3 bytes or a BOM have arrived. WebExtension::resourceStringForPath (Source/WebKit/UIProcess/Extensions/WebExtension.cpp:605) calls decode() once on the whole file and never flush(). Fix: callers that hand the decoder complete data must use decodeAndFlush(), which also cures the pre-existing empty result for CSS files of 13 bytes or fewer at that site. A default-locale messages.json of "{}" then fails to parse and every locale is dropped.

Why this was flagged

An extension resource of 1 or 2 bytes with a non-CSS/HTML/XML MIME type, e.g. a _locales/en/messages.json containing "{}", is read through WebExtension::resourceStringForPath at Source/WebKit/UIProcess/Extensions/WebExtension.cpp:603-609, which creates a TextResourceDecoder, calls decode(data->span()) once, caches and returns the result, and never calls flush(). On the base branch decode() left m_checkedForBOM false for fewer than 3 bytes, and for PlainText/JSON content types fell straight through to m_codec->decode, so "{}" came back as "{}". After the change, Source/WebCore/loader/TextResourceDecoder.cpp:563-566 appends the data to m_buffer and returns emptyString() whenever checkForBOM did not set m_checkedForBOM, which is exactly the under-3-byte case. WebExtensionLocalization::localizationJSONForWebExtension (Source/WebKit/Shared/Extensions/WebExtensionLocalization.cpp:250-257) then gets "" from resourceStringForPath, JSON::Value::parseJSON fails and it returns nullptr; for the default locale the constructor at WebExtensionLocalization.cpp:68-73 calls loadRegionalLocalization(nullptr, nullptr, nullptr, emptyString(), emptyString()), so the user's regional and language messages.json files are never loaded either. On the base branch the same "{}" parsed to an empty object and the other locales still loaded.

Verification: Source/WebCore/loader/TextResourceDecoder.cpp:561-567 now does if (!m_checkedForBOM) { m_buffer.append(data); return emptyString(); }, and checkForBOM (line 408-409) only sets m_checkedForBOM for a BOM or 3 or more bytes. On the base (e450c49, lines 551-556) decode() fell through to m_codec->decode and returned "{}". WebExtension.cpp:602-609 calls decode() once with no flush().

Comment on lines +909 to +910
else if (auto coopValue = document.crossOriginOpenerPolicy().value; !coopValueReported && coopValue != CrossOriginOpenerPolicyValue::SameOrigin && coopValue != CrossOriginOpenerPolicyValue::SameOriginPlusCOEP)
reason = makeString("the Cross-Origin-Opener-Policy header value '"_s, coopHeader, "' is not 'same-origin'"_s);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (optional) Developers on builds where COOP is disabled get a self-contradictory warning: "the Cross-Origin-Opener-Policy header value 'same-origin' is not 'same-origin'". The new diagnostic reads document.crossOriginOpenerPolicy().value at Source/WebCore/loader/FrameLoader.cpp:909, but that value is only populated when crossOriginOpenerPolicyEnabled is true (DocumentLoader.cpp:966), and it defaults to UnsafeNone. Fix: skip the "not cross-origin isolated" message, or name "COOP support is disabled" as the reason, whenever settings().crossOriginOpenerPolicyEnabled() is false, and keep that gate for every header combination (COOP+COEP, COOP+bad COEP).

Why this was flagged

A top-level https document served with 'Cross-Origin-Opener-Policy: same-origin' and 'Cross-Origin-Embedder-Policy: require-corp' is loaded in an embedder where CrossOriginOpenerPolicyEnabled is false; the preference's default is false outside WebKit2 (Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:1726-1728). With the setting off, DocumentLoader.cpp:966 never sets m_responseCOOP, so FrameLoader.cpp:998 never calls setCrossOriginOpenerPolicy and the document keeps the default CrossOriginOpenerPolicyValue::UnsafeNone (CrossOriginOpenerPolicy.h:58). logCrossOriginIsolationDiagnostics (FrameLoader.cpp:1003) then sees crossOriginIsolated() false, checkValue reports nothing because 'same-origin' is a recognized token, and the branch at FrameLoader.cpp:909 fires, logging "This document is not cross-origin isolated because the Cross-Origin-Opener-Policy header value 'same-origin' is not 'same-origin'. window.crossOriginIsolated is false and SharedArrayBuffer is unavailable." The reason is false. The base branch logs nothing for this document. Nothing guards the function on the setting; only document state is consulted.

Verification: DocumentLoader.cpp:966-967 only populates m_responseCOOP when settings().crossOriginOpenerPolicyEnabled(), so the document keeps the default CrossOriginOpenerPolicyValue::UnsafeNone (CrossOriginOpenerPolicy.h:58). The new logCrossOriginIsolationDiagnostics (FrameLoader.cpp:862-920) is not gated on the setting, so line 909-910 emits a self-contradictory message. Only a console diagnostic is wrong.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings marked 🟡 are optional suggestions and need no follow-up push.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🔴 Source/JavaScriptCore/runtime/CachedTypes.cpp:5324 — Embedders whose on-disk bytecode cache was written by a build at bun/main (revision 14, pre-merge opcode numbering) will have it accepted by this build and decoded with shifted opcode IDs, so cached code mis-executes or crashes instead of being rejected. The merge removes op_is_big_int from BytecodeList.rb, renumbering every opcode after it, but cachedTypesFormatRevision at CachedTypes.cpp:5324 stays at 14, which e450c49 already used for the loop-header change on the old numbering. Fix: bump cachedTypesFormatRevision to 15 with a note naming the op_is_big_int removal (opcode numbering), as revisions 6, 7 and 13 did for earlier renumberings.

    Why this was flagged

    A Bun build from bun/main at e450c49 writes bytecode cache payloads whose version is computeJSCBytecodeCacheVersion() ^ (14 * 0x9E3779B9u) (CachedTypes.cpp:5325); its instruction stream encodes opcodes numbered with op_is_big_int still present in BytecodeList.rb. After this merge BytecodeList.rb no longer has :is_big_int, so op_is_object and every later opcode have an ID one lower, yet HEAD still computes the same version key because cachedTypesFormatRevision is 14 at CachedTypes.cpp:5324. The embedder-supplied part of the key is documented at CachedTypes.cpp:5310-5311 as something that 'need not notice' such reinterpretation, and the same comment says 'Bump when you do that'; revisions 6, 7 and 13 were bumped for 'opcode numbering'. The payload passes isStillValid, instructions() at CachedTypes.cpp:4183 hands the raw bytes to a JSInstructionStream, and the interpreter dispatches each old opcode ID as the wrong instruction. On the base branch (e450c49) numbering and revision agree, so no stale payload is misread.

    Verification: The diff removes :is_big_int in Source/JavaScriptCore/bytecode/BytecodeList.rb, which renumbers op_is_object and every later OpcodeID by one. Source/JavaScriptCore/runtime/CachedTypes.cpp is not in the diff; both base and HEAD have static constexpr uint32_t cachedTypesFormatRevision = 14; (line 5324), and currentCacheVersion() (5325) is the only thing isUpToDate() (5339) compares.

@github-actions

Copy link
Copy Markdown

Preview build of 4a6dc55: autobuild-preview-pr-889-4a6dc55b

@dylan-conway
dylan-conway merged commit 8deea35 into main Oct 23, 2026
54 of 55 checks passed
dylan-conway added a commit to oven-sh/bun that referenced this pull request Oct 24, 2026
### What does this PR do?

Moves `WEBKIT_VERSION` from `5e3554face13` to `680ef47cec2c`, the head
of oven-sh/WebKit `main`. The `autobuild-680ef47c…` release is
published.

What the fork's `main` gained in that range:

- oven-sh/WebKit#889: merge of upstream
[`f59345e04a8d`](WebKit/WebKit@f59345e)
(2026-10-22). 193 upstream commits since `33ce3bf11a71`, 37 of them in
JavaScriptCore, WTF or bmalloc.
- oven-sh/WebKit#892: a completely full block that the allocator
stumbles on is recorded as allocated.
- oven-sh/WebKit#880: the control flow profiler counts the parts of a
loop header.
- oven-sh/WebKit#807: `BytecodeOptimizer` aborted when jump offsets
settled one pass before the forced widening.
- oven-sh/WebKit#881: CI only (sha256 for toolchain downloads, FreeBSD
14.4, which is what Bun already targets). The Android NDK is unchanged.

`JSType.h`, the WebCore bindings code generator and the release tarball
names did not change.

#### Changes in Bun besides the version

**BIGINT32 is gone upstream**
([`f59345e04a`](WebKit/WebKit@f59345e)).
It was never enabled (`USE_BIGINT32` was `0`), so none of this changes
behaviour, but Bun does not compile without it:

- `JSBigInt::makeHeapBigIntOrBigInt32(g, v)` → `JSBigInt::createFrom(g,
v)`, which is what it expanded to (`NodeSqlite.cpp`, `JSBuffer.cpp`,
`JSCTestingHelpers.cpp`). Every call site passes an `int64_t` or a
`uint64_t`, so the overload is exact.
- `JSValue::isBigInt32()` always returned `false`. Removed:
`JSC__JSValue__isBigInt32` and `JSValue::is_big_int32`, their uses in
`toBeEven` / `toBeOdd`, an `ASSERT` in `JSC__JSValue__asBigIntCompare`,
and the test bindgen emitted for a `bigint` that is not a cell.
- `tryConvertToBigInt32(bigInt)` → `bigInt` in
`SerializedScriptValue.cpp`.
- The `#if USE(BIGINT32)` blocks in `bindings.cpp`,
`SerializedScriptValue.cpp` and `napi.cpp`, which call functions that no
longer exist.
- The `JSGlobalObject*` of `JSC__JSValue__asBigIntCompare`, which only
one of those blocks read, and with it the `global` of
`JSValue::as_big_int_compare` and of the test runner's wrapper.

**Loop headers have basic blocks of their own** (oven-sh/WebKit#880):

- `JSInspectorProfiler.cpp` leaves out the blocks with
`m_isInLoopHeader`. V8 has no range for them, and what reads
`Profiler.takePreciseCoverage` is written for V8's ranges.
- `source-positions-corpus.ts`: the count of nine loop header lines.
`for (let i = 0; i < 3; i++) {` is 4, how often the condition ran, and
was 1.

Both are the same hunks as in #46534, so they merge cleanly with it.
`WEBKIT_VERSION` will conflict there: #46534 pins `e450c494a84f`, which
this contains.

**`test/bundler/bundler_bytecode_portable.test.ts`**: the snapshot.
Removing `op_is_big_int` renumbers the opcodes after it, so the
serialized bytecode changed on every platform. 24 hashes and 13 sizes of
`.jsc` payloads change, and no hash of the printed JavaScript.

**`test/js/bun/jsc/webkit-upgrade-f59345e04a.test.ts`** (new): pins five
of the engine changes below, like the files for the earlier syncs.

#### Other upstream changes that reach Bun

Checked against Bun's sources, no change needed:

- `numberToShortestStringBufferSize` is 39, was 34. Bun passes the
124-byte `NumberToStringBuffer`.
- `JSObject::forEachOwnIndexedProperty` lost its `JSGlobalObject*`,
`immutableButterflyToStringCache` moved from `Heap` to `VM`, the inline
parts of `HasOwnPropertyCache` moved to `HasOwnPropertyCacheInlines.h`,
the `swapCodeRefForDebugger` family moved to `NativeExecutable`. Bun
uses none of them.
- `JSBoundFunction::create` gained an overload that takes a
`SourceTaintedOrigin`. The one that takes a `SourceCode`, which Bun
calls, is still there.
- `SpecDataViewObject` is bit 49, was 50. Bun has no copy of
`SpeculatedType`.
- The bytecode cache key is a hash of the WebKit commit, so a cache
written before the opcodes were renumbered is not read.

Behaviour that changes with the engine:

- In the head of a `for`: a destructuring declaration without an
initializer is a SyntaxError, `let` is an identifier in sloppy code, and
`for await (async of` is allowed
([`926bafc4e`](WebKit/WebKit@926bafc4e)).
- An overwritten `length` of a sloppy arguments object is converted with
`ToLength`
([`7b1cfc54c`](WebKit/WebKit@7b1cfc54c)). `-1`
was 4294967295, so `Array.prototype.slice.call(arguments)` looped 2^32
times, and 2^32 and up were truncated.
- `Stopwatch::reset()` clears past run intervals
([`49902180d`](WebKit/WebKit@49902180d)), and
moving a `SamplingProfiler::StackTrace` keeps `stopwatchTimestamp`
([`b6c984205`](WebKit/WebKit@b6c984205)).
- DFG fixes: a promise resolved with itself was fulfilled with itself in
optimized code instead of rejected with a TypeError
([`b45f2446d`](WebKit/WebKit@b45f2446d)),
`op_has_private_name` is not compiled as `InById`
([`dd24421c8`](WebKit/WebKit@dd24421c8)).
- GC: leftover marks after the marking version wraps
([`e1a28d3cf`](WebKit/WebKit@e1a28d3cf)), a
heap's Collector threads stop when it shuts down
([`eaf0efa57`](WebKit/WebKit@eaf0efa57)).

### How did you verify your code works?

No local build. The first commit was built by CI
([#131689](https://buildkite.com/bun/bun/builds/131689)): all 13
`build-bun` jobs and the three `verify-baseline` jobs passed, so the
aarch64 allowlist stays as it is, and the only test that failed was the
bytecode snapshot, on all ten platforms that ran it.

With the `bun-linux-x64` binary of that build, and the one of `main` at
`a8fcd319` ([#131688](https://buildkite.com/bun/bun/builds/131688),
WebKit `5e3554face13`) as the baseline:

| | `main` | this PR |
| --- | --- | --- |
| `webkit-upgrade-f59345e04a.test.ts` | 0 of 5 pass | 5 of 5, also with
`BUN_JSC_useJIT=0` |
| `bundler_bytecode_portable.test.ts` | | 22 of 22 with the new
snapshot, 21 of 22 before |
| `source-positions.test.ts` | | 325 of 325 |
| `inspector-profiler.test.ts` | | 52 of 52 |

The snapshot was written by `--update-snapshots` on Linux x64. All 24
hashes are the ones in the CI logs of Windows x64, Linux aarch64 and
Linux x64 ASAN, and the 11 that the annotation shows are the same on all
ten platforms.

The second commit's Rust was checked with `cargo check -p bun_jsc -p
bun_runtime`; its C++ (one signature) is first compiled by CI.

Before the first build, by reading: the diff of every JavaScriptCore,
WTF and bmalloc header in the range, with each removed or changed name
searched for in Bun, and every `JSBigInt::` member Bun uses looked up in
the new `JSBigInt.h`.


---
_Generated by [Claude Code](https://claude.ai/code)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
samm-git pushed a commit to samm-git/WebKit that referenced this pull request Nov 4, 2026
…815e94

360 upstream commits since f59345e (the previous upgrade, oven-sh#889), 59 of
them in Source/JavaScriptCore, Source/WTF or Source/bmalloc.

This records upstream/main as a parent, so the next upgrade finds its base by
itself as long as this lands as a merge commit and not as a squash.

16 files conflicted. JSType.h, OptionsList.h, .github/workflows,
.github/scripts, the Dockerfiles, the WebCore bindings scripts and the
structured clone sources are untouched. BytecodeList.rb loses the unused type
WasmBoundLabel and no opcode. The bytecode of loops changes all the same:
bd50166 fuses a null test or a negated comparison into a backward jump.

BytecodeGeneratorBase is folded into BytecodeGenerator (4e5e850)

  - BytecodeGenerator.h, BytecodeGenerator.cpp: upstream's class and
    constructors, with the two parameters the fork adds to each constructor.
    The FunctionNode constructor calls allocateCalleeSaveSpace() first and
    sets m_isPrivateBuiltinFunction after it.
  - BytecodeGeneratorBase.h (deleted upstream, changed by the fork): deleted.
    The fork's change was `friend class BytecodeOptimizerAccess`, which
    BytecodeGenerator already has.
  - Label.h: upstream's file. BoundLabel::saveTarget() has the fork's 16 bits
    for a forward jump when Options::runsCompiledImage().
  Merged without a conflict and no longer compiled:
  - bytecode/BytecodeOptimizer.cpp includes BytecodeGeneratorInlines.h, and
    resets m_lastOpcodeID to op_debug, which is the value
    JSGeneratorTraits::opcodeForDisablingOptimizations had.

JSON.parse (6f5f583, 2dff3f1)

  Upstream rewrote the object branch of LiteralParser::parseRecursively as one
  loop, with a loop inside it for the keys that JSONCache knows. The function
  is upstream's, and the fork's changes are applied to it again:
  - parseValue(): a cached string is only looked up when
    Lexer::mayHaveCachedString(), and only taken when its text is ASCII or the
    source is not UTF-8. A string that cannot be allocated goes to
    parsePrimitiveValue(), which throws (tryMakeJSString).
  - The new loop reads the key and a string value from a local cursor, not
    from the lexer. It has the same conditions on the name entry and on the
    string entry. Lexer::mayHaveCachedString() has an overload that takes the
    position, and the spans are of Lexer::CachedCharType.
  - The generic key lookup does not follow a transition that is not cacheable
    (VM::mayHaveUncacheableTransitions()), in its two places.
  - LiteralParser.h: upstream's end() and setPtr(), and the fork's isAtEnd(),
    positionAfterLastToken() and advanceTo(). The fork's own end() is dropped.
  - Lexer::skipWhitespaceBeforeKey() is removed, as upstream. The fork's
    lessThanOrNotASCII() stays where it was.

Object spread and rest of a function (e04a6f9)

  - JSGlobalObjectFunctions.cpp: upstream's condition, on the fork's
    finalTarget.
  Merged without a conflict and changed for the fork:
  - JSFunction::canPerformFastEnumerablePropertyEnumeration() is false for a
    compiled closure. AOT::Closure::getOwnSpecialPropertyNames() makes the
    class object and the static fields before the properties are listed, and
    a walk of the Structure would not see them. Before this merge every
    function took the generic path, so a compiled closure does what it did.

Thread::tryCreate() (45f193a)

  Both sides added it. Upstream's is unconditional, and Thread::create()
  calls it. With ENABLE(AOT) the code is the fork's: create() waits for room
  and names the thread when it crashes, and tryCreate() with a time to wait
  does the work. Without ENABLE(AOT) it is upstream's create() and
  tryCreate(). The declaration of tryCreate() is outside of #if ENABLE(AOT).

The other conflicts

  - JSStringJoiner.cpp (e81441a): JSOnlyStringsAndInt32sJoiner is
    renamed JSExactLengthJoiner. The fork's joinImpl() for doubles is renamed
    with it, and so is its use in aot/builtins/AOTBuiltinArrayOperations.cpp.
  - ArrayConstructor.js (37aa2b5): upstream deleted the for-await
    defaultAsyncFromAsyncIterator and gave its name to
    defaultAsyncFromAsyncIteratorWithNext. The fork's check that |this|
    constructs an object stays in the four places that are left.
    aot/builtins/engine-syntax.builtins.ts no longer lists
    defaultAsyncFromAsyncIteratorWithNext.
  - CMakeLists.txt, ProxyRevoke.h (fad04e2): ProxyRevoke is removed
    upstream. The fork's only change to it was a quoted include.
    runtime/ProxyObjectInlines.h stays in the list of private headers.
  - VM.cpp (fad04e2): both, m_proxyRevokeExecutable and the fork's
    m_aotState.visitAggregate().
  - YarrJIT.cpp (1984003): upstream's walkedSlots, in both arms of the
    fork's YARR_FOR_IMAGE.
  - PlatformEnable.h (e8f7048): upstream's block of *_DISABLED defaults.
  - WebCore/rendering/svg/RenderSVGResourceFEImage.h is a new upstream file
    that git took for a rename of the deleted ProxyRevoke.h. Upstream's file.

Tests

  - JSTests/stress/proxy-revocable-result-and-revoke-function.js
    (fad04e2): upstream expects three lines from toString() of the
    revoke function. The fork writes a native function on one line (A2 in
    JSTests/BUN-TEST-DIFFERENCES.md, which lists the file now).

Heap world state (0bf94cf, 4bc9ad4, cf89f15)

  Upstream asserts the bits of Heap::m_worldState in release builds, in
  stopTheMutator(), resumeTheMutator(), acquireAccessSlow(),
  releaseAccessSlow(), setNeedCollectionEpilogue(), setMutatorWaiting(),
  clearMutatorWaiting() and in three functions of Collector. They merged
  without a conflict. The fork keeps three pairs of such asserts commented
  out, in the two stopIfNecessarySlow() and in
  handleNeedCollectionEpilogue(unsigned). None of the new asserts is in those
  functions, and every caller of the functions that have them is upstream's.

Verified

  - Every file that the fork had not changed is identical to upstream's, but
    for the test above. Every file that upstream had not changed is identical
    to main's, but for BytecodeOptimizer.cpp, AOTBuiltinArrayOperations.cpp,
    engine-syntax.builtins.ts, BUN-TEST-DIFFERENCES.md and CLAUDE.md.
  - No use is left of BytecodeGeneratorBase, GenericLabel, GenericBoundLabel,
    JSGeneratorTraits, ProxyRevoke, proxyRevokeStructure,
    JSOnlyStringsAndInt32sJoiner, defaultAsyncFromAsyncIteratorWithNext,
    InlineCallFrame::BoundFunctionCall, BoundFunctionTailCall,
    skipWhitespaceBeforeKey, LOGF, SD_JOURNAL_SEND, PAS_MIN_OBJECTS_PER_PAGE
    or PAS_MAX_OBJECT_SIZE.
  - A Debug build of the jsc target on Linux x64 (clang 23, JSCOnly, without
    ASAN) compiles and links. With it 308 stress tests pass in their default
    mode: the 19 that upstream added or changed in this range,
    stress/bun-aot-builtins-table.js, and the tests around the code above
    (JSON, Array.from, join, spread, rest, Proxy, iterator helpers, RegExp,
    bound functions, switch on a string). The shell ran with Malloc=1.
    Without it this configuration stops at startup on an assertion of
    mimalloc (arena.c:1379, from StructureMemoryManager), in code that the
    merge does not change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.